<template>
    <div class="page flex-v-center">
        <van-image  width="155" height="148" :src="flag === 'success'?success_ico:error_ico" class="mb-36" />
        <div class="f16 color-gary">{{flag === 'success'?'本次交易支付成功！':'支付失败！'}}</div>
        <div class="bind-btn can" @click="linkTo()">
            点击跳转
        </div>
    </div>
</template>
<script setup lang="ts">
import {ref} from "vue"
import { useRoute,useRouter } from "vue-router"
import success_ico from '@/assets/images/success_ico.png';
import error_ico from '@/assets/images/error_ico.png';
const route = useRoute();
const router = useRouter();

const flag = ref(route.query?.isOk);
const linkTo = () => {
    // 获取url中的参数
    if(route.query?.redirect_uri) {
        window.location.href = decodeURIComponent(route.query?.redirect_uri.toString());
    } else {
        router.replace({ path: "/" });
    }
}
</script>

<style lang="less">
.bind-btn {
     width:90%;
        margin-top: 80px;
        height: 44px;
        background: #BFBCB8;
        color: #fff;
        border-radius: 22px;

        display: flex;
        justify-content: center;
        align-items: center;

        font-size: 16px;
        font-weight: 500;

        &.can {
            background: #F59A23;
        }
    }
    </style>
